<!doctype html>

<head>
    <!-- meta -->
    <meta charset="utf-8">
    <meta name="description" content="Flat, Clean, Responsive, admin template built with bootstrap 3">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <!-- /meta -->

    <title>心秘籍系统</title>


    <bstablecss />
    <commonheader />
</head>
<body>

<div class="app">
    <link rel="stylesheet" href="__PUBLIC__/css/userinfoEdit.css" type="text/css">
    <section class="layout">

        <!-- main content -->
        <section class="main-content">

            <!-- content wrapper -->
            <div class="content-wrap">
                <div class="row">
                    <div class="col-md-8 col-md-offset-2">
                        <section class="panel panel-info">
                            <header class="panel-heading">编辑个人资料</header>
                            <div class="panel-body">
                                <div class="col-md-10 col-md-offset-1">
                                    <section class="panel">

                                        <div class="panel-body">
                                            <form role="form">
                                                <div class="form-group">
                                                    <label for="user_img">头像</label>
                                                    <div>
                                                        <img src="/Public/asset/img/face.jpg" class="avatar avatar-lg bordered-avatar " alt="">
                                                        <input type="file" class="form-control" id="user_img">
                                                    </div>
                                                    <label>修改用户名</label>
                                                    <div>
                                                        <input type="text" class="form-control" id="new-username-val" value="{$rs.username}">
                                                        <a class="btn-success btn" id="save-newusername">点击修改</a>
                                                    </div>

                                                    <label>修改邮箱</label>
                                                    <div>
                                                        <input type="email" class="form-control" id="new-useremail-val" value="{$rs.email}">
                                                        <a class="btn-success btn" id="save-newuseremail">点击修改</a>
                                                    </div>

                                                    <label>修改密码</label>

                                                    <div>
                                                        <input type="password" class="form-control" id="passwd" placeholder="新密码">
                                                        <input type="password" class="form-control" id="repasswd" placeholder="确认密码">
                                                    </div>

                                                </div>


                                                <a class="btn btn-default" id="newpwd-submit">修改密码</a>
                                            </form>
                                        </div>
                                    </section>
                                </div>
                            </div>
                        </section>
                    </div>
                </div>


            </div>
            <!-- /content wrapper -->

        </section>
        <!-- /main content -->

    </section>

</div>
<commonfooter />
<bstablejs />
<jqnestablejs />

<script>
    $(document).ready(function(){



        $("#save-newusername").click(function(){
            $.ajax({
                url:"/TestHome/UserInfo/editUsername",
                dataType:"json",
                type:"POST",
                data:{
                    username:$("#new-username-val").val()
                },
                success:function(data){
                    alert(data.msg);
                },
                error:function(jqXHR){
                    alert("提交错误"+jqXHR.status);
                }
            })
        });

        $("#save-newuseremail").click(function(){
            $.ajax({
                url:"/TestHome/UserInfo/editUseremail",
                dataType:"json",
                type:"POST",
                data:{
                    useremail:$("#new-useremail-val").val()
                },
                success:function(data){
                    alert(data.msg);
                },
                error:function(jqXHR){
                    alert("提交错误"+jqXHR.status);
                }
            })
        });

        $("#newpwd-submit").click(function(){

            if($("#passwd").val() != $("#repasswd").val()){
                alert('两次输入密码不一致！');
            }
            else{
                $.ajax({
                    url:"/TestHome/UserInfo/editPassword",
                    dataType:"json",
                    type:"POST",
                    data:{
                        newpwd:$("#passwd").val()
                    },
                    success:function(data){
                        alert(data.msg);
                    },
                    error:function(jqXHR){
                        alert("提交错误"+jqXHR.status);
                    }
                })
            }

        });

    });
</script>


<commonfooter />
<bstablejs />

